
#include "..\include\imp_typedefine.h"
#include "..\include\imp_bill_wrapper.h"
#include "..\include\imp_io_wrapper.h"

#include "..\..\imeworks\lib\inc\imebill_engine.h"


void* imp_bill_module_init(void *param)
{
    return (void *)1;
}

void imp_bill_module_deinit(void *h)
{
    //imp_bill_point_cleanup(h);        // do it by applet
}

Int32 imp_bill_init(void *h)
{
    return imebill_engine_init();
}

void imp_bill_change_time(void *h, void* pOldTime)
{
    imebill_engine_change_time(pOldTime);
}

void imp_bill_use_bill_active(void *h)
{
    imebill_set_use_bill_active();
}

Int32 imp_bill_check_frm_bg(void *h, UInt32 flag)
{
    return imebill_engine_check_frm_bg(flag);
}

void imp_bill_check_update_interrupt(void *h)
{
    imebill_engine_check_update_interrupt();
}

void imp_bill_sms_register_recieve_for_charge(void *h, imp_bill_func_sms f_sms)
{
    imebill_sms_register_recieve_for_charge(f_sms);
}

Int32 imp_bill_point_start(void *h, ImpCStr point_id, ImpStr param_data, ImpCStr app_id,
                          imp_bill_confirm_func confirm_cb)
{
	if (h)
	{
        imebill_point_start(point_id, param_data, app_id, (fp_imebill_confirm_cb)confirm_cb);
        return 1;
	}
	else
	{
		return -1;
	}
}

void imp_bill_point_cancel(void *h)
{
    imebill_point_cancel();
}

Int32 imp_bill_confirm(void *h, UInt16 retval, ImpStr param_data)
{
    return imebill_confirm(retval, param_data);
}

void imp_bill_point_cleanup(void *h)
{
    imebill_point_cleanup();
}

Int32 imp_bill_sms_send_req(void *h, ImpStr imsi, ImpStr sms_no, ImpStr sms_content_utf8,
                            Int8 sms_repeat, Int32 dcs_flag, Int32 delay_sec)
{
    return imebill_bill_sms_send_req(imsi, sms_no, sms_content_utf8, sms_repeat, dcs_flag, delay_sec);
}

void imp_bill_get_use_bill_serial(void *h, ImpStr rand_buf)
{
    imebill_get_use_bill_serial(rand_buf);
}

Int32 imp_bill_update_time_is_expired(void* h)
{
    return imebill_update_time_is_expired();
    
}

void imp_bill_update_req(void *h, imp_use_bill_update_func func, void *param1, void *param2)
{
    imebill_update_req((use_bill_update_cb)func, param1, param2);
}

void imp_bill_update_cancel(void *h)
{
    imebill_update_cancel();
}

ImpBool imp_bill_update_engine_info(void *h, e_impbill_info_id id, void* param)
{
    return imebill_update_engine_info((e_imebill_info_id)id, param);
}

Int16 imp_bill_filter_sms(void *h, ImpStr sms_num, Int16 num_len, ImpUStr sms_data, 
                          Int16 data_size, Int32 is_from_slave)
{
    return imebill_filter_sms(sms_num, num_len, sms_data, data_size, is_from_slave);
}

void imp_bill_update_base_url(void *h, ImpStr base_url)
{
    imebill_update_base_url(base_url);
}

void imp_bill_send_sms_response(void *h, ImpBool result, void* param)
{
    imebill_send_sms_response(result, param);
}

